<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript"
	src="<%=basePath%>resources/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=2.0&ak=jlki1tGE6TYFSOKnwM7Hnpe8UG3KGwv0"></script>
<title>Insert title here</title>
<style>
.error {
	color: #ff0000;
	font-weight: bold;
}
</style>
</head>
<body>
	<%-- 	<form action="<%=basePath%>user/login" method="post">
		账号：<input type="text" name="username" />
		密码：<input type="password" name="password"/> 
		<input type="submit" value="提交"/>
	</form> --%>

	<%-- <form:form method="post"  modelAttribute="user" action="/Loong/user/login">   
        <table>   
            <tr>   
                <td>账号</td>   
                <td><form:input  path="username"/>   
                </td>   
                <td><form:errors  path="username" cssClass="error" />   
                </td>   
            </tr>   
            <tr>   
                <td>密码</td>   
                <td><form:input path="password"/>   
                </td>
                <td><form:errors path="password" cssClass="error" />   
                </td>   
            </tr>   

            <tr>   
                <td colspan="3"><input type="submit" value="提交"/>   
                </td>   
            </tr>   
        </table>   
    </form:form>    --%>

	<span>账号：</span>
	<input type="text" id="username" />
	<span>密码：</span>
	<input type="password" id="password" />
	<button id="show">提交</button>

	<div id="container" style="height: 500px; width: 600px"></div>
	<script type="text/javascript">
		var map = new BMap.Map("container"); // 创建地图实例  
		var point = new BMap.Point(116.404, 39.915); // 创建点坐标  
		map.centerAndZoom(point, 15); // 初始化地图，设置中心点坐标和地图级别
	</script>
</body>
<script type="text/javascript">
	$(function() {
		$('#show').click(function() {
			var username = $('#username').val();
			var password = $('#password').val();
			var user = {
				"username" : username,
				"password" : password
			};
			$.ajax({
				type : "post",
				url : "/Loong/user/loginTest",
				data : user,
				dataType : "json",
				ContentType : "application/json;charset=UTF-8",
				success : function(data) {
					if (data && data.success == "true") {
						window.location.href = data.view;
					} else {
						alert("error");
					}
				}
			});
		});
	});
</script>
</html>

